--tell application "ListSTAR Server" to set s9SenderEmailAddress to {FreeFormName:"Joshua D. Baer", EMailAddress:"josh@starnine.com"} as StarNineAddress
--set s9mailsubject to "Doug Walner"
--Place this script in the folder with the same name as the service you just created
--(ie. Hard Drive->ListSTAR/SMTP->Services-><Service Name>).
--Change the value for the ServiceName variable to be the same as the name of your Service.
set ServiceName to "<your Service Name>"
--End of Configuration Area
set intro to "Sending page to: "
set bodyintro to "Body: "
--max length of pages
set maxlength to 240
--the file which contains the body of the page
set strStart to path to me
set strListSTARpath to text from character 1 to character -16 of (strStart as string)
set thefile to strListSTARpath & "Services:" & ServiceName & ":Outgoing Page"
--the email address of the server
set serviceEmailAddress to "notify@thelorax.starnine.com"
tell application "Notify!™ Server"
--DEBUG CODE
tell application "ListSTAR Server"
StarNine Log "constructing page" Log Level Debug
end tell
--read in body of message
try
set textsource to open for access file (thefile) --open the file with the digest in it
set thetext to read textsource from 1 -- read the entire file into theBody
close access textsource --close the file
on error errString number errNum
return -1
display dialog errString & " " & errNum
end try
--check to see if body is too long, if so truncate
set theheader to (count of characters in (intro & s9mailsubject & bodyintro)) + 1
if ((count of characters in thetext) + theheader) is greater than maxlength then set thetext to (characters 1 through (maxlength - theheader) of thetext)
--if subscriber is known, page him
if ((s9mailsubject is in (DoScript "Get Subscribers")) or (s9mailsubject is in (DoScript "Get Groups"))) then
tell application "ListSTAR Server"
StarNine Log "sending page" Log Level Debug
end tell
Page s9mailsubject as string Message thetext as string
else --else subscriber is not known, so reply and say so
tell application "ListSTAR Server"
StarNine Send ¬
"Notify!" To s9SenderEmailAddress ¬
Subject s9mailsubject & ¬
" is not a known subscriber or group" Body s9mailsubject & " is not a known subscriber or group. For a complete listing, send mail to \"" & serviceEmailAddress & "\" with the word \"subscribers\" in the subject." & return & return & "Original text of page follows:" & return & return & thetext